

function initWxShareContent(obj){
  var wxShareContent = obj;
  wx.ready(function (res) {
      wx.onMenuShareTimeline({
          title: wxShareContent.title, // 鍒嗕韩鏍囬
          link: wxShareContent.link, // 鍒嗕韩閾炬帴
          imgUrl: wxShareContent.imgUrl, // 鍒嗕韩鍥炬爣
          desc:wxShareContent.desc,
          success: function () {
              // 鐢ㄦ埛纭鍒嗕韩鍚庢墽琛岀殑鍥炶皟鍑芥暟

          },
          cancel: function () {
              // 鐢ㄦ埛鍙栨秷鍒嗕韩鍚庢墽琛岀殑鍥炶皟鍑芥暟
          }
      });
      wx.onMenuShareAppMessage({
          title: wxShareContent.title, // 鍒嗕韩鏍囬
          desc: wxShareContent.desc, // 鍒嗕韩鎻忚堪
          link: wxShareContent.link, // 鍒嗕韩閾炬帴
          imgUrl: wxShareContent.imgUrl, // 鍒嗕韩鍥炬爣
          type: '', // 鍒嗕韩绫诲瀷,music銆乿ideo鎴杔ink锛屼笉濉粯璁や负link
          dataUrl: '', // 濡傛灉type鏄痬usic鎴杤ideo锛屽垯瑕佹彁渚涙暟鎹摼鎺ワ紝榛樿涓虹┖
          success: function () {

          },
          cancel: function () {
              // 鐢ㄦ埛鍙栨秷鍒嗕韩鍚庢墽琛岀殑鍥炶皟鍑芥暟
          }
      });
  })
}


function wxConfigInit(){
      $.ajax({
          type: "get",
          url: baseUrl+"api/weixin/param?url="+location.href.split('#')[0],
          data:"",
          processData: false,
          contentType: false,
          dataType: "json",
          success: function (res) {
              if (res.appid) {
                  wx.config({
                      debug: false, // 寮€鍚皟璇曟ā寮�,璋冪敤鐨勬墍鏈塧pi鐨勮繑鍥炲€间細鍦ㄥ鎴风alert鍑烘潵锛岃嫢瑕佹煡鐪嬩紶鍏ョ殑鍙傛暟锛屽彲浠ュ湪pc绔墦寮€锛屽弬鏁颁俊鎭細閫氳繃log鎵撳嚭锛屼粎鍦╬c绔椂鎵嶄細鎵撳嵃銆�
                      appId: res.appid, // 蹇呭～锛屽叕浼楀彿鐨勫敮涓€鏍囪瘑
                      timestamp: res.timestamp, // 蹇呭～锛岀敓鎴愮鍚嶇殑鏃堕棿鎴�
                      nonceStr: res.nonce, // 蹇呭～锛岀敓鎴愮鍚嶇殑闅忔満涓�
                      signature: res.signature,// 蹇呭～锛岀鍚�
                      jsApiList: ["onMenuShareTimeline", "onMenuShareAppMessage"] // 蹇呭～锛岄渶瑕佷娇鐢ㄧ殑JS鎺ュ彛鍒楄〃
                  })
              }
          }
      });
}
wxConfigInit();
